[][src]Crate cloudevents

This crate implements the CloudEvents Spec for Rust.

use cloudevents::{EventBuilder, AttributesReader};
use chrono::Utc;
use url::Url;

let event = EventBuilder::v10()
    .id("my_event.my_application")
    .source(Url::parse("http://localhost:8080").unwrap())
    .time(Utc::now())
    .build();

println!("CloudEvent Id: {}", event.get_id());
println!("CloudEvent Time: {}", event.get_time().unwrap());

If you're looking for Protocol Binding implementations, look at crates:

  • cloudevents-sdk-actix-web: Integration with Actix Web
  • cloudevents-sdk-reqwest: Integration with reqwest

Modules

event

Provides Event data structure, EventBuilder and other facilities to work with Event

message

Provides facilities to implement Protocol Bindings

Structs

Event

Data structure that represents a CloudEvent. It provides methods to get the attributes through AttributesReader and write them through AttributesWriter. It also provides methods to read and write the event data.

EventBuilder

Builder to create super::Event:

Traits

AttributesReader

Trait to get CloudEvents Context attributes.

AttributesWriter

Trait to set CloudEvents Context attributes.